<@realgodo.cloumn>
<div class="content">
 	<@realgodo.friend_nav/>
	<div class="zs_r r bgff" style="width:780px">
		<div class="py_mn">
			<div class="py_mnh mainColor vd_weight font14">管理我的朋友分组</div>
			<div class="vd_center" id="new_div">
				<form name="saveForm_new" id="new_form" action="${base}/user/friend/catalog!save" method="post">
				<input type="text" class="bodx font14" size="45" name="name" id="catalog_name_new"/>&nbsp;
				<input type="submit" value="新建分组" class="bgff font12" />
				<span class="font12 vd_color9">&nbsp;</span>
				</form>
			</div>
			<div class="vd_center" style="display:none;" id="update_div">
				<form name="saveForm_update" id="update_form" action="${base}/user/friend/catalog!save" method="post">
					<input type="text" class="bodx font14" size="45" name="name" id="catalog_name"/>&nbsp;
					<input type="submit" value="保存" class="bgff font12" />
					<input type="button" value="取消" class="bgff font12" onclick="cancelUpdate()"/>
					<input type="hidden" value="" name="catalogId" id="catalog_id"/>
					<span class="font12 vd_color9">&nbsp;</span>
				</form>
			</div>
			<div class="pymn_list">
				<div>
					<div class="l font13 vd_weight vd_color6">我的朋友(默认)</div>
					<div class="r bga"><#--<a href="#" hidefocus class="font12 mainColor" >编辑</a>--></div>
				</div>
				<#list friendCatalogList as c>
				<div class="p_top all_clear">
					<div class="l font13 vd_weight vd_color6">${c.name!}</div>
					<div class="r bga">
					<a href="#" hidefocus class="font12 mainColor" onclick="updateCatalog('${c.id?c}','${c.name!}')">编辑</a>&nbsp;
					<a href="#" hidefocus class="font12 mainColor" onclick="confirmDelete('${c.id?c}')">删除</a>
					</div>
				</div>
				</#list>
				<#--
				<div class="vd_center" style="margin-top:50px">
					<input type="button" value="保存" class="bgff font13 mainColor vd_weight"  style="padding:10px 25px"/>
					<input type="button" value="取消" class="bgff font13 vd_color6"  style="padding:10px 25px"/>
				</div>
				-->
			</div>
		</div>	
	</div>
</div>
<script>
	function cancelUpdate(){
		document.getElementById("update_div").style.display="none";
		document.getElementById("new_div").style.display="";
		document.getElementById("catalog_name_new").value="";
	}
	
	function updateCatalog(catId,catName){
		document.getElementById("new_div").style.display="none";
		document.getElementById("update_div").style.display="";
		document.getElementById("catalog_name").value=catName;
		document.getElementById("catalog_id").value=catId;
	}
	
	function confirmDelete(catId){
		if(catId==null||catId==""){
			return;
		}
		if(window.confirm('确认删除该分组吗？删除后，该分组的朋友将移至默认分类')){
			window.location.href="${base}/user/friend/catalog!delete?catalogId="+catId;
		}
	}
	
</script>
</@realgodo.cloumn>